//
// File:	Animating.hpp
// Author:	Thomas TISSOT-DUPONT
// E-mail:	<thomas.tissotdupont@free.fr>
// Create:	01/02/2010 21:18:52
// Purpose:	
//
#ifndef ANIMATING_HPP
#define ANIMATING_HPP

#include <map>
#include <SFML/Graphics.hpp>
#include "Animation.hpp"
#include "BaseRenderable.hpp"
#include "IAnimating.hpp"

class Animating : protected BaseRenderable, public IAnimating
{
public:
											Animating();
											~Animating();

public:
	bool									LoadFromFile(const std::string &fileName);

public:
	void									Update();

public:
	void									Render(float flX, float flY);

public:
	void									SetRenderColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a = 255);

public:
	bool									PlayAnimation(const std::string &animName);
	void									PauseAnimation();
	void									ResumeAnimation();
	void									StopAnimation();
	IAnimation								*GetCurrentAnimation() const;
	IAnimation								*GetAnimationByName(const std::string &animName) const;
	bool									AddAnimation(IAnimation &anim);
	int										GetFrameWidth() const;
	int										GetFrameHeight() const;

private:
	void									Clear();

public:
	static IAnimating						*CreateAnimatingFromFile(const std::string &fileName);

private:
	std::map<std::string, IAnimation *>		m_animations;
	sf::Vector2i							m_ivFrameSize;
	IAnimation								*m_pCurrentAnimation;
};

#endif //!ANIMATING_HPP
